package com.example.glaciermessage.listener;

//import com.alibaba.fastjson2.JSON;
//import com.codingfuture.glacioralarm.dto.THDateDTO;
//import com.codingfuture.glacioralarm.service.AlarmRecordService;
import com.example.glaciermessage.service.SmsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.data.redis.core.BoundValueOperations;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

import java.nio.charset.StandardCharsets;

/**
 * @author :zxw
 * @date 2025-04-08 00:03
 * @description:
 */
@Component
public class ListenerMessage implements MessageListener {
    @Autowired
    private SmsService smsService;


    @Override
    public void onMessage(Message message, byte[] pattern) {
//        String information = new String(message.getBody(), StandardCharsets.UTF_8);
//        THDateDTO thDateDTO = JSON.parseObject(information, THDateDTO.class);
//        System.out.println(thDateDTO);
//        alarmRecordService.selectMeter(thDateDTO);


        System.out.println("监听到的消息是"+message.getBody());
    }
}
